package org.baojie.raft.message;

import org.baojie.raft.message.info.MessageInfo;

import java.io.Serializable;

public class VoteResponse extends MessageInfo implements Serializable {

    private static final long serialVersionUID = -8084631843360327133L;

    private int term;
    private boolean voteGranted;

    public VoteResponse() {

    }

    @Override
    public Type type() {
        return Type.AnsVote;
    }

    public int getTerm() {
        return term;
    }

    public void setTerm(int term) {
        this.term = term;
    }

    public boolean isVoteGranted() {
        return voteGranted;
    }

    public void setVoteGranted(boolean voteGranted) {
        this.voteGranted = voteGranted;
    }

    @Override
    public String toString() {
        return "VoteResponse{" +
                "term=" + term +
                ", voteGranted=" + voteGranted +
                '}';
    }

}
